﻿using System;
namespace ValidationEngine.Commons
{
    /// <summary>
    /// Validator collection interface.
    /// </summary>
    internal interface IValidatorsMgr
    {
        /// <summary>
        /// Searches for type validator and register it.
        /// </summary>
        /// <param name="modelType">Model type</param>
        void FindAndRegisterValidatorForType(Type modelType);

        /// <summary>
        /// Returns validator by model type.
        /// </summary>
        /// <param name="modelType">Model type</param>
        /// <returns>Validator instance if found. NULL if not.</returns>
        IValidator GetValidatorForType(Type modelType);

        /// <summary>
        /// Registers validator for model type.
        /// </summary>
        /// <param name="modelType">Model type.</param>
        /// <param name="validator">Validator instance.</param>
        void RegisterValidator(Type modelType, IValidator validator);

        /// <summary>
        /// Checks if validator is registered already.
        /// </summary>
        /// <param name="modelType">Model type</param>
        /// <param name="validator">Validator instance</param>
        /// <returns>True if registered.</returns>
        bool IsValidatorRegistered(Type modelType, IValidator validator);
    }
}
